//
//  TreeNodeModel.m
//  DemoTree
//
//  Created by 尤维维 on 2017/11/10.
//  Copyright © 2017年 EmicNet. All rights reserved.
//

#import "TreeNodeModel.h"

@implementation TreeNodeModel

- (CGFloat)height:(CGFloat)cellHeight headHeight:(CGFloat)headHeight{
    CGFloat h = headHeight;
    if (self.open) {
        for (int i = 0; i < self.items.count; i++) {
            id model = self.items[i];
            if ([model isKindOfClass:[TreeNodeModel class]]) {
                h += [(TreeNodeModel *)model height:cellHeight headHeight:headHeight];
            } else {
                h += cellHeight;
            }
        }
    }
    return h;
}

@end
